<?php

/**
 * sfGuardUserProfile form.
 *
 * @package    ##PROJECT_NAME##
 * @subpackage form
 * @author     ##AUTHOR_NAME##
 */
class sfGuardUserProfileForm extends BasesfGuardUserProfileForm {

    public function configure() {

    }

    public function setup() {

        parent::setup();
        $tiposDoc = array(
            '' => '',
            1 => 'DNI',
            2 => 'LC',
            3 => 'LE',
            4 => 'Pasaporte',
        );
        $this->setWidgets(array(
            'id' => new sfWidgetFormInputHidden(),
            'usr_id' => new sfWidgetFormPropelChoice(array('model' => 'sfGuardUser', 'add_empty' => false)),
            'telefono_1' => new sfWidgetFormInput(),
            'telefono_2' => new sfWidgetFormInput(),
            'tipo_doc' => new sfWidgetFormChoice(array('choices'=>$tiposDoc)),
            'nro_doc' => new sfWidgetFormInput(),
            'direccion' => new sfWidgetFormInput(),
            'email' => new sfWidgetFormInput(),
            'pcia_id' => new sfWidgetFormPropelChoice(array('model' => 'Provincias', 'add_empty' => 'Seleccione una provincia')),
            'loc_id' => new sfWidgetFormPropelChoice(array('model' => 'Localidades', 'add_empty' => 'Seleccione una localidad')),
        ));

        $this->setValidators(array(
            'id' => new sfValidatorPropelChoice(array('model' => 'sfGuardUserProfile', 'column' => 'id', 'required' => false)),
            'usr_id' => new sfValidatorPropelChoice(array('model' => 'sfGuardUser', 'column' => 'id')),
            'telefono_1' => new sfValidatorString(array('max_length' => 50, 'required' => false)),
            'telefono_2' => new sfValidatorString(array('max_length' => 50, 'required' => false)),
            'tipo_doc' => new sfValidatorChoice(array('required' => true,'choices'=>array_keys($tiposDoc))),
            'nro_doc' => new sfValidatorInteger(array('required' => true)),
            'direccion' => new sfValidatorString(array('max_length' => 100, 'required' => false)),
            'email' => new sfValidatorString(array('max_length' => 100, 'required' => false)),
            'pcia_id' => new sfValidatorPropelChoice(array('model' => 'Provincias', 'column' => 'pcia_id', 'required' => false)),
            'loc_id' => new sfValidatorPropelChoice(array('model' => 'Localidades', 'column' => 'loc_id', 'required' => false)),
        ));

        $this->widgetSchema->setNameFormat('sf_guard_user_profile[%s]');

        $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
    }

}
